Skip to content

test(settings): destructive + account flow coverage for SettingsDialog (TCD-05)#1061

Merged
BigSimmo merged 6 commits into
mainfrom
claude/settings-dialog-tests-123366
Jul 22, 2026
Merged

test(settings): destructive + account flow coverage for SettingsDialog (TCD-05)#1061
BigSimmo merged 6 commits into
mainfrom
claude/settings-dialog-tests-123366

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

Adds render coverage for SettingsDialog's destructive privacy actions and account flows (finding TCD-05). The dialog previously had only inert-preferences-marker coverage; the flows that actually mutate state or auth were untested. Test-only, no product code changes.

  • Clear recent searches invokes clearRecentQueries (and is disabled when the count is zero).
  • Clear saved items invokes accountData.clearFavourites and surfaces the "Saved items cleared." status notice.
  • Sign out invokes the onSignOut callback.
  • Email sign-in submits the entered address to auth.signInWithEmail.

Reuses the harness shape from settings-inert-preferences.dom.test.tsx: the data-storage, auth, and account-data hooks are mocked so the flows are asserted without touching real storage or auth, while useTheme/useAppPreferences run unmocked in jsdom.

Verification

  • tests/settings-dialog-actions.dom.test.tsx4/4 pass (jsdom)
  • npm run typecheck, npm run lint, npm run format:check clean
  • UI verification not run: no product code or rendered output changes (test-only); the full unit + jsdom suite runs in CI.

Risk and rollout

  • Risk: none. Test-only; adds one jsdom render test file, no product code touched.
  • Rollback: revert this commit.
  • Provider or production effects: None. Verification was fully offline; no provider calls.

Clinical Governance Preflight

(Touches only a test that mocks the auth hook; no auth/privacy behaviour changes.)

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked — test-only, no clinical decision-support behaviour change

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added a new test suite for the Settings dialog covering privacy/account actions.
    • Verifies “Clear recent searches” enables by default, becomes disabled when no items exist, and triggers the correct clear action.
    • Verifies “Clear saved items” triggers the clear action and shows confirmation messaging.
    • Verifies “Sign out” calls the provided callback and that email-based sign-in renders and submits correctly.

…g (TCD-05)

SettingsDialog owns the destructive privacy actions and the account flows, which
had no render coverage (only the inert-preferences markers were tested). Add
@testing-library/react tests for the wiring that matters:

- Clear recent searches invokes clearRecentQueries (enabled only with a non-zero
  count).
- Clear saved items invokes accountData.clearFavourites and surfaces the
  "Saved items cleared." status notice.
- Sign out invokes the onSignOut callback.
- Email sign-in submits the entered address to auth.signInWithEmail.

Reuses the settings-inert-preferences harness shape: the data/auth/account hooks
are mocked so the flows are asserted without real storage or auth;
useTheme/useAppPreferences run unmocked in jsdom.

Verified: 4/4 pass; typecheck, lint, format:check clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@supabase

supabase Bot commented Jul 22, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 74f276eb-63c8-4cd9-844e-21fbf7d1248b

📥 Commits

Reviewing files that changed from the base of the PR and between 2038225 and 427609b.

📒 Files selected for processing (1)
  • tests/settings-dialog-actions.dom.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/settings-dialog-actions.dom.test.tsx

📝 Walkthrough

Walkthrough

Added a Vitest and React Testing Library suite for SettingsDialog covering recent-search clearing, saved-item clearing, sign-out, and email-based sign-in flows with mocked integrations.

Changes

Settings dialog action tests

Layer / File(s) Summary
Action and sign-in coverage
tests/settings-dialog-actions.dom.test.tsx
Mocks storage, account, and authentication integrations, then verifies destructive actions, sign-out, status messaging, and email sign-in behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the new SettingsDialog test coverage for destructive and account flows.
Description check ✅ Passed The description includes the required Summary, Verification, Risk and rollout, and Clinical Governance sections with relevant details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/settings-dialog-tests-123366

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 686770bbbf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/settings-dialog-actions.dom.test.tsx Outdated
@BigSimmo
BigSimmo enabled auto-merge (squash) July 22, 2026 03:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/settings-dialog-actions.dom.test.tsx`:
- Around line 14-15: Update the test setup around countRecentQueries to accept a
configurable count, then render the settings dialog with a count of 0 in an
additional test case. Assert that the “Clear recent searches” action is
disabled, while preserving the existing enabled-state assertion for a nonzero
count.
- Around line 11-43: Move the clearRecentQueries, clearFavourites, and
signInWithEmail spies into vi.hoisted so the vi.mock factories can safely
reference them during module initialization, while preserving their current mock
behavior. If this suite covers disabled actions, also add coverage for
countRecentQueries returning 0 and verify “Clear recent searches” is disabled.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c177022d-16b1-48c5-8edd-05f423da7162

📥 Commits

Reviewing files that changed from the base of the PR and between 737c2e8 and 2038225.

📒 Files selected for processing (1)
  • tests/settings-dialog-actions.dom.test.tsx

Comment thread tests/settings-dialog-actions.dom.test.tsx Outdated
Comment thread tests/settings-dialog-actions.dom.test.tsx Outdated
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 2 unresolved review comments.

Files modified:

  • tests/settings-dialog-actions.dom.test.tsx

Commit: d550a3d3b0b56c6c038ced76816a872b120bf645

The changes have been pushed to the claude/settings-dialog-tests-123366 branch.

Time taken: 2m 25s

Fixed 1 file(s) based on 2 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@github-actions

Copy link
Copy Markdown

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #4345 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

format:check is a required CI gate and is not part of verify:cheap, so this
slipped through the local run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@BigSimmo
BigSimmo disabled auto-merge July 22, 2026 03:55
@BigSimmo
BigSimmo enabled auto-merge (squash) July 22, 2026 03:56
@BigSimmo
BigSimmo merged commit 3e70a22 into main Jul 22, 2026
17 checks passed
@BigSimmo
BigSimmo deleted the claude/settings-dialog-tests-123366 branch July 22, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant